package com.bsi.rd.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

import javax.xml.ws.Service;

/**
 * @ClassName SpringMvcConfig
 * @Author LiuSong
 * @Date 2020/8/6 11:01
 * @Version 1.0
 * @Description springmvc的配置文件，等于配置springmvc-config.xml
 */
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.bsi.rd", includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = {Controller.class})})
public class SpringMvcConfig implements WebMvcConfigurer {

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/WEB-INF/views");
        viewResolver.setSuffix(".jsp");
        registry.viewResolver(viewResolver);
    }
}
